<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
	$.canEdit = true;
</script>
<script type="text/javascript">
	$.canDelete = true;
</script>
<script type="text/javascript">
	$.canGrant = true;
</script>
<script type="text/javascript">
	$.canEditPwd = true;
</script>
<script type="text/javascript">
	var dataGrid3;
	var ss;
	$(function() {
		dataGrid3 = $('#dataGrid3')
				.datagrid(
						{
							url : '${pageContext.request.contextPath}/accountController/recdataGrid?id=${account.id}',
							fit : true,
							fitColumns : true,
							border : false,
							pagination : true,
							singleSelect : true,
							idField : 'id',
							pageSize : 5,
							pageList : [ 5, 10, 15, 20, 30 ],
							sortName : 'tradedate',
							sortOrder : 'desc',
							checkOnSelect : false,
							selectOnCheck : false,
							nowrap : false,
							frozenColumns : [ [ {
								field : 'id',
								title : 'id',
								width : 150,
							//hidden : true
							}] ],
							columns : [ [ {
								field : 'money',
								title : '金额',
								width : 150,
								sortable : true
							}, {
								field : 'tradeType',
								title : '类型',
								width : 50,
								sortable : true
							}, {
								field : 'tradedate',
								title : '操作时间',
								width : 150,
								sortable : true
							}] ],
							toolbar : '#toolbar2',
							onLoadSuccess : function() {
								$('#searchForm table').show();
								parent.$.messager.progress('close');

								$(this).datagrid('tooltip');
							}
						});
	});

	function depositFun() {
		parent.$
				.modalDialog({
					title : '存款',
					width : 300,
					height : 130,
					id : 'dedialog',
					href : '${pageContext.request.contextPath}/accountController/hqdePage?id=${account.id}&amount=${account.amount}',
					buttons : [ {
						text : '存入',
						handler : function() {
							parent.$.modalDialog.openner_dataGrid = dataGrid3;//因为添加成功之后，需要刷新这个dataGrid，所以先预定义好
							var f = parent.$.modalDialog.handler.find('#form');
							f.submit();
							//应该刷新总金额的
							
						}
					} ]
				});
	}
	
	function drawtFun() {
		parent.$
				.modalDialog({
					title : '取款',
					width : 300,
					height : 130,
					href : '${pageContext.request.contextPath}/accountController/hqdrPage?id=${account.id}&amount=${account.amount}',
					buttons : [ {
						text : '取出',
						handler : function() {
							parent.$.modalDialog.openner_dataGrid = dataGrid3;//因为添加成功之后，需要刷新这个dataGrid，所以先预定义好
							var f = parent.$.modalDialog.handler.find('#form');
							f.submit();
						}
					} ]
				});
	}
	
	function TransferFun() {
		parent.$
				.modalDialog({
					title : '转账',
					width : 600,
					height : 300,
					href : '${pageContext.request.contextPath}/accountController/hqtrPage?id=${account.id}&amount=${account.amount}',
					buttons : [ {
						text : '转出',
						handler : function() {
							parent.$.modalDialog.openner_dataGrid = dataGrid3;//因为添加成功之后，需要刷新这个dataGrid，所以先预定义好
							var f = parent.$.modalDialog.handler.find('#form');
							f.submit();
						}
					} ]
				});
	}
	
</script>
<div class="easyui-layout" data-options="fit : true,border : false">
	<div data-options="region:'center',border:false">
		<table id="dataGrid3"></table>
	</div>
</div>
<div id="toolbar2" style="display: none;">
	      账号:${account.name} 总余额:${account.amount} 币种:${account.currencyStr} 类型:${account.typeStr}<br/>
	   <c:if test="${sessionScope.sessionInfo.loginType}!=5">  
	      <a onclick="depositFun();"
		href="javascript:void(0);" class="easyui-linkbutton"
		data-options="plain:true,iconCls:'pencil_add'">存款</a> 
		 <a onclick="drawtFun();"
		href="javascript:void(0);" class="easyui-linkbutton"
		data-options="plain:true,iconCls:'pencil_add'">取款</a> 
		</c:if>
		 <a onclick="TransferFun();"
		href="javascript:void(0);" class="easyui-linkbutton"
		data-options="plain:true,iconCls:'pencil_add'">转账</a> 
</div>

